<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="hexinyang">	
		<title>处理解挂</title>
		<script language="javascript" type="text/javascript" src="../script/print.js"></script>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>
		<script language="javascript" src="../script/card.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			//页面加载方法
			function load(){
				Eui.showNavigation();	
				setPages(["searchView","detview"]);
				Rpc.loadPage("formDetail","card_detail_div.html");																
			}		
			
			//解除挂失方法
			function doUnLock(){
				var asn = detailForm.asn.value;
				if(showQuestion("是否确认解挂?")){
					if(searchForm.checkType[0].checked){
						if (!showQuestion("请插入主卡后点击确定核对客户身份，或取消返回。")) return;
						try{
							var msg = "当前主卡和预解挂副卡不匹配！"
							CardMgnt.checkMasterCard(detailForm.companyUserId.value,msg);
						}catch(e){showError(e.description);return;}
					}
					DWR.call("blacklistService.unlockLostCard",asn,function(v){		
						showInformation("卡片"+asn+"解除挂失成功");
						switchPage("detview");
						CardMgnt.showPrintView("detview","unLockCard_bill",v.logId,"解挂凭证");
					});
				}
			}
			function readCard(){	
				var asn
				try{
					getCard();
					asn = getAsn();
				}catch(e){showError(e.description);return;}
				searchForm.cardNumber.value = asn;
				DWR.call("mgntQueryService.checkCardUnLock",asn,function(data){
					var cardObj = CardMgnt.convertCardObject(data);
					Common.setValues(detailForm,cardObj);
					detailForm.unlockBtn.disabled = false;
					detailForm.selBtn.disabled = true;
					if (data.companyUserId){							//有单位帐户信息为司机卡解挂
						$("radio1").style.display = "";
						searchForm.checkType[0].checked = true;
					}
				},{blockScreen : true});
			}
			
			//返回，重置
			function onCancel(){
				switchPage("searchView");
				searchForm.reset();
				detailForm.reset();
				detailForm.selBtn.disabled = false;
				detailForm.unlockBtn.disabled = true;
				$("radio1").style.display = "none";
				searchForm.checkType[1].checked = true;
			}
			
		</script>
	</head>	
	<body onload="load()">
	<!--页面导航-->
	<div class="nav">
		<div id="nav">
			&nbsp;
		</div>
	</div>
		<div id="searchView">
			<div class="form">
				<div class="formTitle">读 卡</div>
				<form name="searchForm" id="searchForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label5">
							<tr>
								<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <input type="text" name="cardNumber" readonly class="readonly"><span class="des">*</span></td>
								<td><label>帐户校验</label> <span id="radio1" style="display:none;"><input type="radio" name="checkType" value="1">
								使用主卡 </span><input checked type="radio" name="checkType" value="2">使用证件<span class=red>（请在查询后核对客户帐户信息）</span></td>
							</tr>
					</table>
				</form>
			</div>
			<form id="detailForm" name="detailForm">
				<input type="hidden" name="companyUserId">
				<div class="form">
					<div class="formTitle">卡片明细信息</div>
					<div id="formDetail"></div>
				</div>
				<p>
					<button type="button" name="selBtn" onclick="readCard()">读 卡</button>
					<button type="button" name="unlockBtn" onclick="doUnLock()" disabled>解 挂</button>
					<button type="button" name="resBtn" onclick="onCancel()">重 置</button>
				</p>
			</form>
		</div>
		<div id="detview" style="display:none;">
		</div>
	</body>
</html>